import { defineStore } from 'pinia'
import { ref } from 'vue'
export const useZzjgStore = defineStore(
  'zzjg', // id
  () => {
    const roleInfoMsg = ref([])
    const nodeMessegeVuex = ref({
      level: 0,
      departmentId: '',
    })
    const modeType = ref<number>(1)
    const CHANGEROLEINFO = (data: any) => {
      roleInfoMsg.value = data
    }
    const CHANGENODEMESSEGE = (data: any) => {
      nodeMessegeVuex.value = data
    }
    const CHANGEMIDETYPE = (data: any) => {
      modeType.value = data
    }

    return {
      roleInfoMsg,
      nodeMessegeVuex,
      modeType,
      CHANGEROLEINFO,
      CHANGENODEMESSEGE,
      CHANGEMIDETYPE,
    }
  },
  {
    // 持久化设置（默认存储sessionStorage，https://seb-l.github.io/pinia-plugin-persist/advanced/partial-state.html）
    persist: { enabled: true },
  },
)
